<div class="auth-main">
  <div class="auth-block">
    <h1>修改密码</h1>
    <form [formGroup]="form" (ngSubmit)="onSubmit(form.value)" class="form-horizontal">
      <div class="form-group row">
        <label for="inputName3" class="col-sm-12 control-label">当前用户: {{currentUser}}</label>
      </div>
      <div class="form-group row" [ngClass]="{'has-error': (!oldPassword.valid && oldPassword.touched), 'has-success': (oldPassword.valid && oldPassword.touched)}">
        <label for="inputEmail3" class="col-sm-2 control-label">原密码</label>

        <div class="col-sm-10">
          <input [formControl]="oldPassword" type="password" class="form-control" id="inputEmail3" placeholder="原密码">
        </div>
      </div>
      <div class="form-group row" [ngClass]="{'has-error': (!password.valid && password.touched), 'has-success': (password.valid && password.touched)}">
        <label for="inputPassword3" class="col-sm-2 control-label">新密码</label>

        <div class="col-sm-10">
          <input [formControl]="password" type="password" class="form-control" id="inputPassword3" placeholder="新密码">
        </div>
      </div>
      <div class="form-group row" [ngClass]="{'has-error': (!repeatPassword.valid && repeatPassword.touched), 'has-success': (repeatPassword.valid && repeatPassword.touched)}">
        <label for="inputPassword4" class="col-sm-2 control-label">重复密码</label>

        <div class="col-sm-10">
          <input [formControl]="repeatPassword" type="password" class="form-control" id="inputPassword4" placeholder="密码">
          <span *ngIf="!passwords.valid && (password.touched || repeatPassword.touched)" class="help-block sub-little-text">密码不匹配。</span>
          <span *ngIf="errorMessage" class="help-block sub-little-text">{{errorMessage}}</span>
        </div>
      </div>
      <div class="form-group row">
        <div class="offset-sm-2 col-sm-10">
          <button [disabled]="!form.valid" type="submit" class="btn btn-default btn-auth">确定</button>
        </div>
      </div>
    </form>
  </div>
</div>
